- issuable = @issue || @merge_request
- discussion_locked = issuable&.discussion_locked?

%ul#notes-list.notes.main-notes-list.timeline
  = render "shared/notes/notes"

= render 'shared/notes/edit_form', project: @project

- if can_create_note?
  %ul.notes.notes-form.timeline
    %li.timeline-entry
      .timeline-entry-inner
        .flash-container.timeline-content

        .timeline-icon.d-none.d-sm-none.d-md-block
          %a.author-link{ href: user_path(current_user) }
            = image_tag avatar_icon_for_user(current_user), alt: current_user.to_reference, class: 'avatar s40'
        .timeline-content.timeline-content-form
          = render "shared/notes/form", view: diff_view, supports_autocomplete: autocomplete
- elsif !current_user
  .disabled-comment.text-center.prepend-top-default
    Please
    = link_to "register", new_session_path(:user, redirect_to_referer: 'yes', anchor: 'register-pane'), class: 'js-register-link'
    or
    = link_to "sign in", new_session_path(:user, redirect_to_referer: 'yes'), class: 'js-sign-in-link'
    to comment
- elsif discussion_locked
  .disabled-comment.text-center.prepend-top-default
    %span.issuable-note-warning
      = sprite_icon('lock', size: 16, css_class: 'icon')
      %span
        This
        = issuable.class.to_s.titleize.downcase
        is locked. Only
        %b project members
        can comment.
-# haml-lint:disable InlineJavaScript
%script.js-notes-data{ type: "application/json" }= initial_notes_data(autocomplete).to_json.html_safe
